<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<script>
    var cc=[1,2,7,2,7,4,5,4,4,5,2];
    var dd=[];
    for(i=1;i<cc.length;i++){
        if(cc[i]==2){
            cc.splice(cc[i],1);
        }else{dd.push(cc[i]);}
    }console.log(dd);

</script>
</body>
</html>